import pyperclip
import random
import tkinter
import tkinter.messagebox


def main():
    flag = True

    top = tkinter.Tk()
    top.generate('480x480')
    top.title('固定随机文本生成器')
    panel = tkinter.Frame(top)



def generate_random_str(base_str, randomlength=16):
    """
    生成一个指定长度的随机字符串
    """
    random_str = ''
    # base_str = 'ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz0123456789𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗'
    length = len(base_str) - 1
    for i in range(randomlength):
        random_str += base_str[random.randint(0, length)]
    return random_str

if __name__ == '__main__':

    print('示例输入 tc.al-#n1#m2#s3')
    print('计算结果 tc.al-6𝟑𝟕ber')
    print('n = 123456789')
    print('m = 𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗')
    print('s = abcdefghigklmnopqrstuvwxyz')

    str = input("请输入：")
    cs = input("数量：")
    s = []
    for i in range(int(cs)):
        while True:
            fromtel = str
            if fromtel.find('#') > -1:
                fromtels = fromtel.split('#')
                fromtel = ''
                for tel in fromtels:
                    if len(tel) > 0:
                        if tel[0] == 'n':
                            tel = tel[1:]
                            tel = generate_random_str('123456789', randomlength=int(tel))
                        elif tel[0] == 'm':
                            tel = tel[1:]
                            tel = generate_random_str('𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗', randomlength=int(tel))
                        elif tel[0] == 's':
                            tel = tel[1:]
                            tel = generate_random_str('abcdefghigklmnopqrstuvwxyz', randomlength=int(tel))
                        fromtel = fromtel + tel
            if not fromtel in s:
                s.append(fromtel)
                break
        print(fromtel)
    pyperclip.copy('\n'.join(s))
    print('已自动复制结果到剪贴板')
    input('按任意键退出...')